﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
///Extend 的摘要说明
/// </summary>
public static class Extend
{
	public static string ToDecString(this string decString)
    {
        if (string.IsNullOrEmpty(decString))
        {
            return "0";
        }

        decimal decData = 0;
        decimal.TryParse(decString, out decData);

        return decData.ToString();
    }
    public static string ToDisplayString(this decimal dec)
    {
        return dec.ToString("N2");
    }

    public static string ToDisplayString(this string decString)
    {
        if (string.IsNullOrEmpty(decString))
        {
            return "0";
        }

        decimal decData = 0;
        decimal.TryParse(decString, out decData);

        return decData.ToString("N2");
    }

    public static string ToDisplayString(this Object dec)
    {
        if (dec==null)
        {
            return "0";
        }
        string decString = dec.ToString();
        if (string.IsNullOrEmpty(decString))
        {
            return "0";
        }

        decimal decData = 0;
        decimal.TryParse(decString, out decData);

        return decData.ToString("N2");
    }
}